import { tagListApi,addCaseApi,editCaseApi,getTagsByTypeIdApi,
  getWedTypeApi,handleWedTagApi,createWedTagApi,updateWedTagApi } from './urls';
import { TAG_LIST,WEDTYPE_LIST } from './actionTypes';

const tagListAction = (data)=>({
  type:TAG_LIST,
  payload:data
})

const wedTypeListAction = (data)=>({
  type:WEDTYPE_LIST,
  payload:data
})

export const fatchTagList = (data) =>
    dispatch => tagListApi(data).then((response) => {
      dispatch(tagListAction(response))
});

export const fatchAddCase = (data) =>
    dispatch => addCaseApi(data).then((response) => {
      return response;
});

export const fatchEditCase = (data) =>
    dispatch => editCaseApi(data).then((response) => {
      return response;
});

export const fatchCaseList = (data) =>
    dispatch => getTagsByTypeIdApi(data).then((response) => {
      return response;
});

//婚礼标签列表
export const fatchWedType = (data) =>
    dispatch => getWedTypeApi(data).then((response) => {
      dispatch(wedTypeListAction(response))
});

//婚礼标签操作
export const fatchHandleWedTag = (data) =>
    dispatch => handleWedTagApi(data).then((response) => {
      return response;
});

//婚礼标签编辑保存
export const fatchUpdateWedTag = (data) =>
    dispatch => updateWedTagApi(data).then((response) => {
      return response;
});

//婚礼标签新增保存
export const fatchCreateWedTag = (data) =>
    dispatch => createWedTagApi(data).then((response) => {
      return response;
});

